package com.mybatis.simple.mapper;

import com.mybatis.simple.pojo.TbUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author 咕唧
 * @Date 2022/5/17 15:01
 * @Version 1.0
 */
public interface UserMapper {
    //使用注解代替xml文件查询数据
    @Select("select * from tb_user where id =#{id}")
    TbUser findById(Long id);
    //使用注解插入数据
    @Insert("insert into tb_user (username,password,email,gender,flag,role,code) " +
            "values (username=#{username},password=#{password},email=#{email}," +
            "gender=#{gender},flag=#{flag},role=#{role},code=#{code})")
    void insertUser(TbUser user);


    List<TbUser> findAll();
}
